Registrar

@ApiStatus.Experimental
interface Registrar<T>

A simple registrar for any registered object. This registrar works similarly to the (Neo)Forge way of doing object registration. Create a namespaced registrar instance with createRegistrar

Example registration pattern, in a registration object:

private val ITEMS: Registrar<Item> = ConfigApi.platform().createRegistrar(MOD_ID, Registries.ITEM)

val MY_ITEM = ITEMS.register("name") { MyItem(Item.Settings()) }

Scheduled for stability by 0.7.0

Author

fzzyhmstrs

Since

0.5.9

See also

Functions

Link copied to clipboard
abstract fun createTag(path: String): TagKey<T>

Shorthand method for creating a TagKey of the same type as the registrar

abstract fun createTag(id: Identifier): TagKey<T>

Shorthand method for creating and TagKey with a fully arbitrary id of the same type as the registrar

Link copied to clipboard
abstract fun getRegistry(): Registry<T>

Returns the registry instance this registrar was linked to

Link copied to clipboard
abstract fun init()

Initializes the Registrar. This is required for the registrar to work properly. You don't have to init() before registering objects, necessarily, but it is a good idea.

Link copied to clipboard
abstract fun register(name: String, entrySupplier: Supplier<T>): RegistrySupplier<T>

Registers a game object. On fabric, will use direct registration. On (Neo)Forge, will use deferred registration under the hood.